home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -serious- / programming / e / lsestuff / object.e < prev    next >
Text File  |  1999-11-29  |  1KB  |  45 lines

  1. OPT MODULE
  2.  
  3. EXPORT OBJECT object
  4. ENDOBJECT
  5.  
  6. PROC new(opts=NIL) OF object IS self.o_empty('new()')
  7.  
  8. ->PROC setAttrs(attrs) OF object IS self.o_bla('setAttrs()')
  9.  
  10. ->PROC getAttrs() OF object IS self.o_bla('getAttrs()')
  11.  
  12. PROC end() OF object IS EMPTY ->self.o_empty('end()')
  13.                                   /* fw-code */
  14. PROC getObjectSize() OF object IS Long(^self)
  15.  
  16. PROC getObjectName() OF object IS 'object'
  17.  
  18. PROC cloneObject() OF object
  19. /* this code is snitched from framework */
  20.   DEF copy:PTR TO LONG
  21.   copy:=FastNew(Long(^self))
  22.   CopyMem(self+(SIZEOF LONG),copy,Long(^self)-(SIZEOF LONG))
  23. ENDPROC copy
  24.  
  25. PROC copyObjectFrom(other:PTR TO LONG) OF object
  26.            /* fw-code */
  27.    CopyMem(other+4,self+4,Long(^other)-(SIZEOF LONG))
  28. ENDPROC
  29.  
  30. PROC o_empty(methodname) OF object
  31.    WriteF(' method \s of object \s is EMPTY\n',
  32.             methodname, self.getObjectName())
  33. ENDPROC
  34.  
  35. PROC printObject() OF object
  36.    DEF longs
  37.    DEF a
  38.    longs := self.getObjectSize() / 4
  39.    WriteF('object \s :\n', self.getObjectName())
  40.    FOR a := 0 TO longs-1
  41.       WriteF('\h[8]\n', Long(self + (a * 4)))
  42.    ENDFOR
  43. ENDPROC
  44.  
  45.